package attack.arfok;

import org.newdawn.slick.Animation;
import org.newdawn.slick.geom.Rectangle;

import attack.nartan.SwordStrike;
import framework.BasicFighter;
import framework.Util;

public class ComboClaw extends SwordStrike {

	public ComboClaw(BasicFighter attacker) {
		super(attacker);
		this.spriteSheet = attacker.getAnimations().getSpriteSheet();
		this.attackAnimation = new Animation();
		//this.attackAnimation.addFrame(this.spriteSheet.getSprite(3, 2), 300);
		this.attackAnimation.addFrame(this.spriteSheet.getSprite(0, 3), 300);
		this.attackAnimation.addFrame(this.spriteSheet.getSprite(4, 2), 500);

		this.attackAnimationBackward = Util.getFlippedAnimation(this.attackAnimation, true, false);
	}
	
	@Override
	public Rectangle getHitBox() {
		Rectangle hitBox, att;
		int width, // attack width
		   height, // attack height
		  hitboxY, // x position of the hitbox
		  hitboxX; // y position of the hitbox
		
		att = getAttacker().getHitBox();
		width = (int) (att.getWidth() * 2);
		height = (int) (att.getHeight() / 2);
		hitboxY = (int) (att.getY() +  att.getHeight() / 4);
		hitboxX = 0;
		
		if(attackAnimationUsed == attackAnimation) {
			hitboxX = (int) (att.getX() +  att.getWidth()); 
		} else {
			hitboxX = (int) (att.getX() - width); 
		}
		hitBox = new Rectangle(hitboxX, hitboxY, width, height);
		return attackAnimation.getFrame() == 1 || attackAnimationBackward.getFrame() == 1 ? 
				hitBox : new Rectangle(0, 0, -1, -1);
	}
	
	@Override
	public void onRelease() {
	}
}
